package main
import(
	"fmt"
	"strconv"
	"encoding/json"
	//"unicode/utf8"
)

func ToString(a interface{})string{
	str:=fmt.Sprintf("%d",a)
	return str
}
func ToInt64(s string)int64{
	d,_:=strconv.ParseInt(s, 10, 64)
	return d
}
func ToInt(s string)int{
	d,_:=strconv.ParseInt(s, 10, 10)
	return int(d)
}
func ToJson(m interface{})string{
	mjson,_ :=json.Marshal(m)
	//mString :=string(mjson)
	return string(mjson)
	//fmt.Printf("print mString:%s",mString)
}
func ParseCli_(s string)[]string{
	//nameRune := []rune(s)
	var p=0;//特殊字符标记
	var out []string
	var line string
	//fmt.Printf("%s\n", s)
	for i:=0;i<len(s);i++{
		if(p>0){
			if(p==1){
				line=line+s[i:i+1]
				p=0;
			}else if(p==2){
				if(s[i]==byte(34)){/*停止*/p=0}else{line=line+s[i:i+1]}
			}else if(p==4){
				if(s[i]==byte(39)){/*停止*/p=0}else{line=line+s[i:i]}
			}
		}else if(s[i]==byte(92)){//  \标记
			p=1
		}else if(s[i]==byte(34)){//"
			p=2
		}else if(s[i]==byte(39)){//'
			p=4
		}else if(s[i]==byte(32)){// 空格
			//p=8
			//前面的单独成一个参数
			//fmt.Printf("空格")
			if(line!=""){
			out=append(out,line)
			line=""}
		}else{line=line+s[i:i+1]}
	}
	if(line!=""){
		out=append(out,line)
		line=""}
	return out
}